package com.etalk.crm.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;

/**
 * @Auther: James
 * @Date: 2019/3/26 10:07
 * @Description:
 */
public class WeiXinUtil {
    	 /***
	  * 访问http请求并获取String返回值
	  * @author Jay
	  * @param String url
	  * @return String
	 * @throws IOException
	  * **/
	 public static String httpRequestString(String urlStr){
		 try {
			 URL url = new URL(urlStr);
			 URLConnection connection = url.openConnection();
			 InputStream is = connection.getInputStream();
			 BufferedReader br = new BufferedReader(new InputStreamReader(is,"utf-8"));
			 String result = "";
			 String line = null;
		        while((line = br.readLine())!=null){
		             result+=line;
		        }

				System.out.println("返回数据======="+result);
		 } catch (Exception e) {
				e.printStackTrace();
		 }
		 return "";
	 }
}
